// 用户模块
import request from '@/utils/request'

function userList (queryParam) {
  return request({
    url: '/user/list',
    method: 'get',
    params: queryParam
  });
}

function addUser (param) {
  return request({
    url: '/user/add',
    method: 'post',
    data: param
  });
}

function getUserById (id) {
  return request({
    url: '/user/info',
    method: 'get',
    params: {
      id: id
    }
  });
}

function editUser (param) {
  return request({
    url: '/user/update',
    method: 'post',
    data: param
  })
}

function delUser (id) {
  return request({
    url: '/user/delete',
    method: 'get',
    params: {
      id: id
    }
  });
}

function findUserRole (userId) {
  return request({
    url: '/user/role',
    method: 'get',
    params: {
      userId: userId
    }
  });
}

function setRole (param) {
  return request({
    url: '/user/setRole',
    method: 'post',
    data: param
  });
}

export {
  userList,
  addUser,
  getUserById,
  editUser,
  delUser,
  findUserRole,
  setRole
}
